package main

import (
	"fmt"
	"runtime"
)

type pan struct {
	fun string
}
func pro(en func()){
	defer func() {
		err:=recover()
		switch err.(type) {
		case runtime.Error:
			fmt.Println("runtime error:",err)
		default:
			fmt.Println("error:",err)
		}
	}()
	en()
}
func main()  {
	fmt.Println("运行前")
	pro(func() {
		fmt.Println("手动dj前")
		panic(&pan{"手动触发"})
		fmt.Println("hou")
	})
	pro(func() {
		fmt.Println("jiqian")
		var a *int
		*a =1
		fmt.Println("jiqhou")
	})
}
